import { IFeidaoAiBrowserComponent } from "@feidao/web/interfaces";
import Pie from "@feidao/widgets/fd-wh000005";

export default async function a001(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
	const data = fd.data.node.querySelector<HTMLInputElement>('[data-feidao-id="fd-wh000005-004"]').value;
	if (!data) {
		alert('请输入图表的数据');
	} else {
		const pie = fd.data.node.querySelector<Pie>('[id="fd-wh000005-001"]');
		pie.setAttribute('value', data);
	}

	fd.data.node.querySelector<HTMLAreaElement>('[data-feidao-id="fd-wh000005-003"]').innerHTML = `
const data = fd.data.node.querySelector<HTMLInputElement>('[data-feidao-id="fd-wh000005-004"]').value;
if (!data) {
	alert('请输入图表的数据');
} else {
	const pie = fd.data.node.querySelector<Pie>('[id="fd-wh000005-001"]');
	pie.setAttribute('value', data);
}
	`;
}
